String.prototype.trim = function() {
  return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');  //高效trim
}
function checkEmpty(n){
	if(n==""||n==null){
		return false;
	}
	if(n.indexOf(" ")>0){
		return false;	
	}
}
function checkCNword(n){
	var n2 = n.trim();
	checkEmpty(n2);
	var re = /[^\u4e00-\u9fa5]{3}/;   //check Chinese
	if(!re.test(n2)){
		return false;
	}else{
		return true;	
	}
}

function checkNum(n){
	var n2 = n.trim();
	checkEmpty(n2)
	var re = /^\d{3}$/;
	if(!re.test(n2)) return false; 
	return true;
}

function checkWord(){
	var w = $("#word");
	checkCNword(w);
}
function qiuqian(){
//	alert("QiuQian");
	var url = 'doForcast';
//	var pars = "word="+$('#word')+"&num="+$('#num');
	var pars = "word="+document.getElementById("word").value;
	$.ajax({
		url:url,
		type:"POST",
		dataType:'json',
		data:pars,
		complete: showQian
	});
}

function showQian(data,status){
	var t = data.responseText;
//	alert(t);
	var q = JSON.parse(t);
	var Qno = q.Qno;
	var Qdetail = q.Qdetail;
	var Qexplain = q.Qexplain;
//	document.getElementById("Qno").innerHTML=Qno;
//	document.getElementById("Qdetail").innerHTML=Qdetail;
//	document.getElementById("Qexplain").innerHTML=Qexplain;
	$("#qshow").show();
	$("#Qno").html(Qno);
	$("#Qdetail").text(Qdetail);
	$("#Qexplain").text(Qexplain);
	
}



